<template>
	<view class="container">
		<uni-list>
			<picker mode="date" @change="onBindStartDate">
				<uni-list-item :showArrow="true" title="年份" :rightText="start_Date" />
			</picker>
			<picker mode="date" @change="onBindEndDate">
				<uni-list-item :showArrow="true" title="周期" :rightText="start_Week" />
			</picker>
		</uni-list>
		<view class="w-btns">
			<view class="w-btns-btn">
				<button type="primary" plain="true" class="c-input-btn" @click="onCancel">取 消</button>
			</view>
			<view class="w-btns-btn">
				<button type="primary" class="c-input-btn" @click="onSearch">提 交</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				start_Date: "请选择",
				start_Week: "请选择"
			}
		},
		methods: {
			onBindStartDate(e) {
				this.start_Date =new Date(e.target.value).getFullYear().toString();
			},
			onBindEndDate(e) {
				this.start_Week =  this.getWeekNumYear(new Date(e.target.value).getFullYear(), new Date(e.target.value).getMonth() +
					1, new Date(e.target.value).getDate()).toString();
			},
			onCancel(e) {
				uni.navigateTo({
					url: "./WeeklyReportList"
				});
			},
			onSearch(e) {
				uni.navigateTo({
					url: "./WeeklyReportList?start_Date=" + this.start_Date + "&start_Week=" + this.start_Week
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #F1F5F6;
	}

	.w-btns {
		display: flex;
		justify-content: space-between;
		position: fixed;
		right: 0;
		bottom: 0;
		width: 100%;
		background-color: #FFFFFF;
	}

	.w-btns-btn {
		width: 50%;
		padding: 20rpx 10rpx;
	}

	.c-input-btn {
		width: 100%;
	}
</style>
